<div class="_j_commentlist">
    <div class="rev-list">
        <ul>
        <#list page.content as c>
            <li class="rev-item comment-item clearfix _lhp_commentId${c.id}">
                <div class="user">
                    <a class="avatar" href="#" target="_blank"><img src="${(c.userHeadUrl)!}" width="48"
                                                                    height="48"></a>
                    <span class="level">LV ${(c.level)!}</span></div>
                <a class="useful" data-id="190380348" title="点赞">
                    <i></i><span class="useful-num"></span>
                </a>
                <a class="name" href="#" target="_blank">${(c.username)!}</a>
                <span>
                    <#list 1..(c.synStarnum) as k>
                        <i class="fa fa-star fa-lg"></i>
                    </#list>
                </span>
                <p class="rev-txt">${(c.content)!}</p>


                <div class="rev-img">
                    <#list (c.photoUrlList)! as photo>
                        <a href="#" target="_blank"><img src="${photo}" height="120"></a>
                    </#list>
                </div>

                <div class="info clearfix">
                    <a href="javascript:void(0);" class="btn-comment _j_comment _lhp_add_reply" title="添加评论"
                       onclick="showReplyTextarea${c.id}();">评论</a>
                    <span class="time">${c.createTime?string('yyyy-MM-dd HH:ss')}</span>
                </div>
            <#--回复框-->
                <div class="comment add-reply">
                    <ul class="more_reply_box comment_list"></ul>

                    <div class="add-comment reply-form hide _lhp_add_reply_area${c.id}">
                        <textarea class="comment_reply _lhp_comment_reply${c.id}" data-comment_id="${c.id}"
                                  data-comment_username="${c.username}" data-comment_user_id="${c.userId}"
                                  data-scenic_id="${c.scenicId}" data-scenic_name="${c.scenicName}" data-parent_id=""
                                  data-parent_uid=""
                                  data-parent_username="" placeholder="发表评论"
                                  style="color: rgb(204, 204, 204);" onblur="retractTextarea${c.id}();"></textarea>
                        <a class="btn btn_submit_reply" href="javascript:void(0);" onclick="addReply${c.id}();">回复</a>
                    </div>
                </div>

                <script>
                    //
                    showReplyTextarea${c.id} = function () {
                        $("._lhp_add_reply_area${c.id}").removeClass("hide");
                    };
                    retractTextarea${c.id} = function () {
                        $("._lhp_add_reply_area${c.id}").removeClass("hide").addClass("hide");
                    };

                    //                     发表一级回复
                    addReply${c.id} = function () {
                        var scenicId = $("._lhp_comment_reply${c.id}").data('scenic_id');
                        var scenicName = $("._lhp_comment_reply${c.id}").data('scenic_name');
                        var commentId = $("._lhp_comment_reply${c.id}").data('comment_id');
                        var commentUserId = $("._lhp_comment_reply${c.id}").data('comment_user_id');
                        var commentUsername = $("._lhp_comment_reply${c.id}").data('comment_username');
                        var content = $("._lhp_comment_reply${c.id}").val();
                        if (!content) {
                            popup("评论内容必填");
                            return;
                        }
                        $("._lhp_comment_reply${c.id}").val('');
                        $.post("/scenic/replyAdd", {
                            scenicId: scenicId,
                            scenicName: scenicName,
                            commentId: commentId,
                            commentUserId: commentUserId,
                            commentUsername: commentUsername,
                            content: content
                        }, function (data) {
                            if (data.success) {
                                //修改评论数
                                $(".replay_num").html(data.data);

                                $("#currentPage").val(1);
                                $("#replyForm${c.id}").submit();  //重新查一次回复
                            }
                        });
                    }
                </script>

            <#------------------------------------------------------------------------------------------------>

                <form id="replyForm${c.id}" action="/scenic/reply" method="post">
                    <input type="hidden" name="scenicCommentId" value="${c.id!}">
                    <div class="com-box " id="scenicReplyTpl${c.id}">
                    <#--template中的内容-->
                    </div>
                </form>
                <script>
                    $(function () {
                        // 初始显示评论内容
                        $("#replyForm${c.id}").ajaxForm(function (data) {
                            $("#scenicReplyTpl${c.id}").html(data);
                        });
                        $("#replyForm${c.id}").submit();
                    })
                </script>

            </li>
        </#list>
        </ul>
    </div>

    <div style="float: right">
        <div style="float: left;"><span style="line-height:30px"> 共${page.totalPages!}页 / ${page.totalElements}条&nbsp;&nbsp;&nbsp;</span>
        </div>
        <div id="pagination" class="jq-pagination" style="display: inline;"></div>
    </div>
    <script>
        $("#pagination").jqPaginator({
                    totalPages: ${page.totalPages!0},
                    visiblePages: 5,
                    currentPage: ${page.number+1} || 1,
                prev
        :
        '<a class="prev" href="javascript:void(0);">上一页<\/a>',
                next
        :
        '<a class="next" href="javascript:void(0);">下一页<\/a>',
                page
        :
        '<a href="javascript:void(0);">{{page}}<\/a>',
                last
        :
        '<a class="last" href="javascript:void(0);" >尾页<\/a>',
                onPageChange
        :
        function (page, type) {
            if (type == 'change') {
                $("#currentPage").val(page);
                $("#searchForm").submit();
            }

        }
        })
    </script>
</div>